import React from 'react'
import Header from './Header'
import DevEnv from './development'
import ProEnv from './product'

import './index.css'

class AdminOverview extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      tabVal: '1',
    }

    request
      .get(
        '/kapis/resources.kubesphere.io/v1alpha3/clusters?limit=-1&sortBy=createTime&page=1'
      )
      .then(res => {
        console.log(res)
      })
  }

  changeTab = val => {
    this.setState({ tabVal: val })
  }

  render() {
    const { tabVal } = this.state
    return (
      <div className="projectOverview">
        <Header changeTab={this.changeTab} />
        {tabVal === '1' && <DevEnv {...this.props} />}
        {tabVal === '2' && <ProEnv {...this.props} />}
      </div>
    )
  }
}

export default AdminOverview
